//
//  RootTabBarViewController.m
//  product_B
//
//  Created by lanou on 16/5/26.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "RootTabBarViewController.h"
#import "HomePageViewController.h"
#import "ReadViewController.h"
#import "MovieViewController.h"
#import "MusicViewController.h"
@interface RootTabBarViewController ()
@property (nonatomic,strong)HomePageViewController *homeVC;
@property (nonatomic,strong)ReadViewController *readVC;
@property (nonatomic,strong)MovieViewController *movieVC;
@property (nonatomic,strong)MusicViewController *musicVC;
@end

@implementation RootTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.homeVC = [[HomePageViewController alloc]init];
    self.readVC = [[ReadViewController alloc]init];
    self.movieVC = [[MovieViewController alloc]init];
    self.musicVC = [[MusicViewController alloc]init];
    [self addChildViewController:self.homeVC title:@"首页" image:@"首页.png"];
    [self addChildViewController:self.readVC title:@"阅读" image:@"阅读.png"];
    [self addChildViewController:self.musicVC title:@"音乐" image:@"音乐.png"];
    [self addChildViewController:self.movieVC title:@"电影" image:@"电影.png"];
}

- (void)addChildViewController:(UIViewController *)childController title:(NSString *)title image:(NSString *)image
{
    UINavigationController *navc = [[UINavigationController alloc]initWithRootViewController:childController];
    navc.navigationBar.hidden = YES;
    navc.tabBarItem = [[UITabBarItem alloc]initWithTitle:title image:[UIImage imageNamed:image] selectedImage:nil];
    [self addChildViewController:navc];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    [self becomeFirstResponder];
}

- (BOOL) canBecomeFirstResponder {
    return YES;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
